<?php
/**
 *@file commentauthinfo.php
 *@author yuebin
 *@date 2015-7-31
 *@brief  
 */
namespace haibao\comment\data;

class CommentAuthInfo extends \haibao\comment\data\BaseMysql{
	public function __construct() {
		parent::__construct ( '\haibao\comment\model\data\CommentAuthInfo' );
	}
	
	public function getAutoInfoByUserId($userId){
		

		$sql='select * from CommentAuthInfo where UserId = %s';
		return $this->query($sql,array($userId))->fetch_assoc();
	}
	
	public function getAuthInfo($userId){
		$result = null;
		$sql = "select AuthData,SelectedStatus from CommentAuthInfo where UserId=%s";
		$data = $this->query($sql,array($userId));
		while ($data->fetch_assoc()){
			$result['AuthData'] = $data->getData('AuthData');
			$result['SelectedStatus'] = $data->getData('SelectedStatus');
		}
		return $result;
	}
	
	public function updateAuthDataByUserId($userId,$arrSet){
		array_push($arrSet,$userId);
		$sql = 'update CommentAuthInfo set AuthData=%s,SelectedStatus=%s where UserId=%s';
		$this->query($sql,$arrSet);
	}
}